import * as Constant from '../constant'


// 登录
export const login = (payload) =>  ({
    type: Constant.LOGIN,
    payload
})
// 退出登录
export const logout = (payload) =>  ({
    type: Constant.LOGOUT,
    payload
})

// 异步存货
export const addAsync = (payload) => {
    return dispatch => {

        dispatch({
            type: Constant.LOGIN_LOADIG,
            payload: true
        })

        setTimeout(() => {
            dispatch({
                type: Constant.LOGIN,
                payload
            })
            
            dispatch({
                type: Constant.LOGIN_LOADIG,
                payload: false
            })

        }, 1e3)
    }
}